package com.haibei.adapter.bean;

import java.util.ArrayList;

import com.common.bean.IBeanInterface;
import com.common.uitl.StringUtils;
import com.haibei.net.NetInterface;

/**
 * @author zhanglei
 * @desc 话题
 */
public class Topic implements IBeanInterface {

	private static final long serialVersionUID = 5167615300955713219L;

	private String id;
	private String author;
	private String conmentCount;
	private String title;
	// 导语
	private String lead;
	private String content;
	// 封面图片地址
	private String coverImg;
	// 话题来源
	private String origin;
	// 原文链接
	private String originalLink;
	// 发布时间
	private String publishTime;
	// 期数
	private String period;
	private boolean isTop;
	// 页面所需

	private ArrayList<ContentItem> cotentList;
	private TopicSelected topicSelected;

	public Topic() {
		cotentList = new ArrayList<ContentItem>();
	}

	public ArrayList<ContentItem> getCotentList() {
		return cotentList;
	}

	public void setCotentList(ArrayList<ContentItem> cotentList) {
		this.cotentList = cotentList;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public boolean isTop() {
		return isTop;
	}

	public void setTop(boolean isHot) {
		this.isTop = isHot;
	}

	public String getAuthor() {
		return author;
	}

	public void setAuthor(String author) {
		this.author = author;
	}

	public String getConmentCount() {
		return conmentCount;
	}

	public void setConmentCount(String conmentCount) {
		this.conmentCount = conmentCount;

	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getLead() {
		return lead;
	}

	public void setLead(String lead) {
		this.lead = lead;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
		if (!StringUtils.isEmpty(content)) {
			String[] splite = content.split("<<img>>|<</img>>");
			for (String item : splite) {
				item="    "+item;
				item = item.replace("<<br/>>", "\n");
				item= item.replace("<<br/>>", "\n");
				if (!StringUtils.isEmpty(item)) {
					ContentItem i = new ContentItem(item);
					this.cotentList.add(i);
				}

			}
		}
	}

	public String getCoverImg() {
		return coverImg;
	}

	public void setCoverImg(String coverImg) {
		// this.coverImg = coverImg;
		this.coverImg = NetInterface.warpImgUrl(coverImg);
	}

	public String getOrigin() {
		return origin;
	}

	public void setOrigin(String origin) {
		this.origin = origin;
	}

	public String getOriginalLink() {
		return originalLink;
	}

	public void setOriginalLink(String originalLink) {
		this.originalLink = originalLink;
	}

	public String getPublishTime() {
		return publishTime;
	}

	public void setPublishTime(String publishTime) {
		this.publishTime = publishTime;
	}

	public String getPeriod() {
		return period;
	}

	public void setPeriod(String period) {
		this.period = period;
	}

	public TopicSelected getTopicSelected() {
		return topicSelected;
	}

	public void setTopicSelected(TopicSelected topicSelected) {
		this.topicSelected = topicSelected;
	}

}
